<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Page同步</title>
</head>
	<script type="text/javascript" src="${pageContext.request.contextPath }/statics/js/jquery-3.5.1.js"></script>
	<script type="text/javascript">
		/* function pagechange1(aaa){
			$("#start").href="${pageContext.request.contextPath }/page.do?currentPage="+aaa；
		function pagechange2(aaa){
			$("#ever").href="${pageContext.request.contextPath }/page.do?currentPage="+aaa；
		function pagechange3(aaa){
			$("#end").href="${pageContext.request.contextPath }/page.do?currentPage="+aaa； */
		function pagechange(aaa){
			window.location.href="${pageContext.request.contextPath }/page.do?currentPage="+aaa;
		}
	</script>
<body>
	<table>
		<tr><th>用户名</th><th>密码</th><th>权限</th></tr>
		<c:forEach items="${page.lists }" var="user">
			<tr><td>${user.username }</td><td>${user.password }</td><td>${user.permissions }</td></tr>
		</c:forEach>
	</table>
	<div>
	<span style="border: 1">
		<c:if test="${page.currentPage!=1 }">
			<%-- <a href="${pageContext.request.contextPath }/page.do?currentPage=${page.currentPage-1}">上一页</a> --%>
			<a href="#" id="start" onclick="pagechange(${page.currentPage-1})">上一页</a>
		</c:if>
		<c:if test="${page.currentPage==1}">
			<a href="#">上一页</a>
		</c:if>
	</span>
		<c:forEach begin="1" end="${page.pages}" var="num">
	<%-- 		<a href="${pageContext.request.contextPath }/page.do?currentPage=${num}" id="ever" onclick="pagechange(${num})">${num }</a>	 --%>	
		<span style="border: 1" 
			<c:if test="${page.currentPage==num}">
				style="color:red"
			</c:if>
		>
			<a href="#" id="ever" onclick="pagechange(${num})">${num }</a>	
		</span>	
		</c:forEach>
		
	<span style="border: 1">
		<c:if test="${page.currentPage!=page.pages}">
			<%-- <a href="${pageContext.request.contextPath }/page.do?currentPage=${page.currentPage+1}">下一页</a> --%>
			<a href="#" id="end" onclick="pagechange(${page.currentPage+1})">下一页</a>
		</c:if>
		<c:if test="${page.currentPage==page.pages}">
			<a href="#">下一页</a>
		</c:if>
	</span>
		${page.currentPage },${page.pages}
	</div>
</body>
</html>